import React, { Component } from 'react'
import DialogSon from './DialogSon'

export default class Dialog extends Component {
    state = {
        flag: false
    }
    changeFlag = (flag) => {
        this.setState({
            flag
        })
    }
    render() {
        const { flag } = this.state
        return (
            <div>
                <button onClick = {() => {
                    this.setState({
                        flag: true
                    })
                }}>点我</button>

                {
                    flag? <DialogSon changeFlag = { this.changeFlag }/>: ""
                }
                
            </div>
        )
    }
}
